#!/bin/bash

OS=$(uname -s)

check_tool() {
    TOOL=$1
    if [ "$OS" == "Linux" ]; then
        if ! command -v $TOOL &>/dev/null; then
            echo "Error: $TOOL is not installed on your system."
            return 1
        else
            echo "$TOOL is installed."
        fi
    elif [ "$OS" == "Darwin" ]; then
        if ! command -v $TOOL &>/dev/null; then
            echo "Error: $TOOL is not installed on your system."
            return 1
        else
            echo "$TOOL is installed."
        fi
    elif [[ "$OS" == MINGW* || "$OS" == CYGWIN* || "$OS" == MSYS* ]]; then
        if ! where $TOOL > /dev/null 2>&1; then
            echo "Error: $TOOL is not installed on your system."
            return 1
        else
            echo "$TOOL is installed."
        fi
    else
        echo "Unknown operating system: $OS"
        return 1
    fi
}

tools=("gcc" "make")

for tool in "${tools[@]}"; do
    check_tool $tool
done

echo "Tool check completed."
